package ru.spbsu.electromenu.util.collections;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * Date: 5/2/11
 * Time: 12:23 AM
 *
 * @author Artem Titov
 */
public class CollectionUtils {

    public static <T extends Idable> Map<Integer, T> mapFromCollection(final Collection<T> collection) {
        final Map<Integer, T> result = new HashMap<Integer, T>();
        for (final T object : collection) {
            result.put(object.getId(), object);
        }
        return result;
    }
}
